package com.cskaoyan.controller.backstagecontroller;

import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.StatRowsVo;
import com.cskaoyan.service.StatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 统计报表:
 * 1.用户统计
 * 2.商品统计
 * 3.订单统计
 */
@RestController
@RequestMapping("admin/stat")
public class StatController {
    @Autowired
    StatService statService;

    @RequestMapping("user")
    public BaseRespVo getUserStat() {
        StatRowsVo statUser = statService.getStatUser ();
        return BaseRespVo.ok (statUser);
    }

    @RequestMapping("goods")
    public BaseRespVo getGoodsStat(){
        StatRowsVo statGoods = statService.getStatGoods ();
        return BaseRespVo.ok (statGoods);
    }

    @RequestMapping("order")
    public BaseRespVo getOrderStat(){
        StatRowsVo statOrder = statService.getStatOrder ();
        return BaseRespVo.ok (statOrder);
    }

}
